<template>
    <div class="test-dynamic">
        <div class="get-user" @click="getUserInfo">点击获取用户id</div>
        <div class="get-user" @click="back">back</div>
        <div class="get-user" @click="shareImage">shareImage</div>
        <div class="get-user" @click="shareUrl">shareUrl</div>
        <div>{{userId}}</div>
    </div>
</template>
<script>
import yryz from '../../js/yryz.js';
export default {
    data() {
        return {
            userId: ''
        }
    },
    methods: {
      back() {
        yryz.back()
      },

     /* share  data数据结构
      data:{
         type:  img | url  分享的类型  图片 | 链接
         url : ‘’  链接的url
      }
     */
      shareImage() {
		let { shareImageUrl, shareDataUrl, title, description } = this.activityInfo;
        let data = {
			type: 'img',
			url: shareDataUrl,
			imgUrl: shareImageUrl,
			content: description,
			title
        }
        this.$yryz.share(data);
      },
      shareUrl() {
        let data = {
           type: 'url',
        }
        yryz.share(data);
		},
		async getActivityInfo() {
			let res = await this.$http.get(`/lovelorn/v1.3/pb/activity-info/action/info`, { params: { activityCode: '123'}});
			this.activityInfo = res.data.data;
		},
		async getUserInfo() {
			let header = await yryz.httpHeader();
			this.userId = header.userId;
		},
	},
	mounted() {
		this.getActivityInfo();
	}
}
</script>

